<template>
    <div>
        <button @click="isShow=!isShow">显示/影藏</button>
        <transition-group name="v2" appear>
            <h1 v-show="isShow" key="1">你好啊!</h1>
            <h1 v-show="isShow" key="2">jiale!</h1>
        </transition-group>
    </div>
</template>

<script>
export default {
    name: "TestVue",
    data() {
        return {
            isShow: true
        }
    }
}
</script>

<style scoped>
h1 {
    background-color: #00afff;
}

.v2-enter-active, .v2-leave-active {
    transition: 0.5s linear;
}

/*进入的起点*/
.v2-enter, .v2-leave-to {
    transform: translateX(-100%);
}

/*进入的终点*/
.v2-enter-to, .v2-leave {
    transform: translateX(0);
}

</style>